/**
 * Created by bian on 16-12-14.
 */
import {createStore,applyMiddleware,compose} from "redux"
import promiseMiddleware from "redux-promise"
import DevTools from "../containers/Devtools.jsx"

var enhancer = compose(
    //你要使用的中间件，放在前面
    applyMiddleware(promiseMiddleware),
    //必须的！启用带有monitors（监视显示）的DevTools
    // DevTools.instrument()
)

exports.createStoreWithMiddleware = function createStoreWithMiddleware(rootReducer,initialState){       // 覆盖connect的initial？
    //注意：仅仅只有redux>=3.1.0支持第三个参数
    const store = createStore(rootReducer,initialState,enhancer)
    return store
}
